<?php
require_once '../facebook-platform/client/facebook.php';

$appapikey = 'eef9c88585177c346d136f2d7e1676c8';
$appsecret = '0bab813d384192da6305454d788b769a';
$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login();

//[todo: change the following url to your callback url]
//$appcallbackurl = 'http://localhost/test/index.php';
$appcallbackurl = 'http://geekygrl.com/facebook/test/';

//catch the exception that gets thrown if the cookie has an invalid session_key in it
try {
  if (!$facebook->api_client->users_isAppAdded()) {
    $facebook->redirect($facebook->get_add_url());
  }
} catch (Exception $ex) {
  //this will clear cookies for your application and redirect them to a login prompt
  $facebook->set_user(null, null);
  $facebook->redirect($appcallbackurl);
}

